package redis

import (
	"context"
	"fmt"
	"time"
)

const (
	FormToMsg  = "form_to:"
	GroupToMsg = "group_to:"
)

func (r Redis) PushListRight(key, value string, duration time.Duration) (err error) {
	err = r.Client.RPush(context.Background(), key, value).Err()
	err = r.Client.Expire(context.Background(), key, duration).Err()
	return
}
func (r Redis) GetAllValue(key string) (res []string, err error) {
	fmt.Println(key)
	res, err = r.Client.LRange(context.Background(), key, 0, -1).Result()
	return
}
func (r Redis) DelList(key string) (err error) {
	fmt.Println(key)
	len, _ := r.Client.LLen(context.Background(), key).Result()
	for i := 0; i < int(len); i++ {
		re, err := r.Client.RPop(context.Background(), key).Result()
		fmt.Println(re)
		if err != nil {
			return err
		}
	}
	return
}
